#include "junix.h"

int 
main(int argc, char **argv)
{
	//int fd=open(__FILE__,O_RDONLY);
	int fd=open("XXX",O_RDONLY);
	if(fd==-1)
		err_sys("open");

	FILE* fp=fdopen(fd,"r");
	if(fp==NULL)
		err_quit("fdopen");

	char buf[LINE_MAX];
	while( fgets(buf, LINE_MAX, fp) != NULL )
	{
		assert(buf[strlen(buf)-1]=='\n');
		buf[strlen(buf)-1]='\0';
		fputs(buf,stdout);
	}	

	return 0;
}
